home *** CD-ROM | disk | FTP | other *** search
/ HAM Radio 1997 / HAM Radio 1997.iso / vcls / wsanet8a / wsanet / wfinger / vb30 / wfinger.frm < prev    next >
Text File  |  1996-04-08  |  12KB  |  423 lines

  1. VERSION 2.00
  2. Begin Form Main 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "WFinger - Test of WSANET"
  5.    ClientHeight    =   5265
  6.    ClientLeft      =   990
  7.    ClientTop       =   1680
  8.    ClientWidth     =   6930
  9.    Height          =   5925
  10.    Icon            =   WFINGER.FRX:0000
  11.    Left            =   945
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   5265
  14.    ScaleWidth      =   6930
  15.    Top             =   1065
  16.    Width           =   7020
  17.    Begin Ini Ini 
  18.       Left            =   6480
  19.       Top             =   1920
  20.    End
  21.    Begin SSPanel StatusBar 
  22.       Align           =   2  'Align Bottom
  23.       Alignment       =   1  'Left Justify - MIDDLE
  24.       AutoSize        =   3  'AutoSize Child To Panel
  25.       BackColor       =   &H00C0C0C0&
  26.       Caption         =   "Ok."
  27.       Font3D          =   3  'Inset w/light shading
  28.       Height          =   255
  29.       Left            =   0
  30.       TabIndex        =   0
  31.       Top             =   5010
  32.       Width           =   6930
  33.    End
  34.    Begin SSFrame FrameTextDisplay 
  35.       Alignment       =   2  'Center
  36.       Font3D          =   3  'Inset w/light shading
  37.       Height          =   3855
  38.       Left            =   120
  39.       TabIndex        =   6
  40.       Top             =   960
  41.       Width           =   6255
  42.       Begin TextBox TextDisplay 
  43.          Height          =   3495
  44.          Left            =   120
  45.          MultiLine       =   -1  'True
  46.          ScrollBars      =   2  'Vertical
  47.          TabIndex        =   7
  48.          Text            =   "Empty."
  49.          Top             =   240
  50.          Width           =   6015
  51.       End
  52.    End
  53.    Begin NetClient NetClient 
  54.       Left            =   6480
  55.       LineDelimiter   =   ""
  56.       RecvSize        =   4096
  57.       RecvThreshold   =   0
  58.       Top             =   1425
  59.    End
  60.    Begin SSPanel PanelLocalName 
  61.       Align           =   1  'Align Top
  62.       Alignment       =   6  'Center - TOP
  63.       BackColor       =   &H00C0C0C0&
  64.       BevelWidth      =   2
  65.       Caption         =   "LocalHost"
  66.       Font3D          =   1  'Raised w/light shading
  67.       Height          =   855
  68.       Left            =   0
  69.       MousePointer    =   2  'Cross
  70.       TabIndex        =   1
  71.       Top             =   0
  72.       Width           =   6930
  73.       Begin SSPanel PanelUsername 
  74.          Alignment       =   6  'Center - TOP
  75.          AutoSize        =   3  'AutoSize Child To Panel
  76.          BackColor       =   &H00C0C0C0&
  77.          Font3D          =   1  'Raised w/light shading
  78.          Height          =   255
  79.          Left            =   120
  80.          TabIndex        =   5
  81.          Top             =   480
  82.          Width           =   1215
  83.          Begin TextBox TextUserName 
  84.             BackColor       =   &H00C0C0C0&
  85.             BorderStyle     =   0  'None
  86.             FontBold        =   0   'False
  87.             FontItalic      =   0   'False
  88.             FontName        =   "MS Sans Serif"
  89.             FontSize        =   8.25
  90.             FontStrikethru  =   0   'False
  91.             FontUnderline   =   0   'False
  92.             Height          =   225
  93.             Left            =   15
  94.             MaxLength       =   64
  95.             TabIndex        =   9
  96.             Text            =   "iblenke"
  97.             Top             =   15
  98.             Width           =   1185
  99.          End
  100.       End
  101.       Begin SSPanel PanelHost 
  102.          Alignment       =   6  'Center - TOP
  103.          AutoSize        =   3  'AutoSize Child To Panel
  104.          BackColor       =   &H00C0C0C0&
  105.          Font3D          =   1  'Raised w/light shading
  106.          Height          =   255
  107.          Left            =   1740
  108.          TabIndex        =   3
  109.          Top             =   480
  110.          Width           =   5040
  111.          Begin TextBox TextHost 
  112.             BackColor       =   &H00C0C0C0&
  113.             BorderStyle     =   0  'None
  114.             FontBold        =   0   'False
  115.             FontItalic      =   0   'False
  116.             FontName        =   "MS Sans Serif"
  117.             FontSize        =   8.25
  118.             FontStrikethru  =   0   'False
  119.             FontUnderline   =   0   'False
  120.             Height          =   225
  121.             Left            =   15
  122.             MaxLength       =   128
  123.             TabIndex        =   4
  124.             Text            =   "rhino.ess.harris.com"
  125.             Top             =   15
  126.             Width           =   5010
  127.          End
  128.       End
  129.       Begin Label LabelLocalAddr 
  130.          Alignment       =   2  'Center
  131.          BackStyle       =   0  'Transparent
  132.          Caption         =   "Label2"
  133.          FontBold        =   0   'False
  134.          FontItalic      =   0   'False
  135.          FontName        =   "MS Sans Serif"
  136.          FontSize        =   8.25
  137.          FontStrikethru  =   0   'False
  138.          FontUnderline   =   0   'False
  139.          Height          =   255
  140.          Left            =   120
  141.          TabIndex        =   8
  142.          Top             =   240
  143.          Width           =   6735
  144.       End
  145.       Begin Label LabelAt 
  146.          BackColor       =   &H00C0C0C0&
  147.          Caption         =   "@"
  148.          FontBold        =   -1  'True
  149.          FontItalic      =   0   'False
  150.          FontName        =   "MS Sans Serif"
  151.          FontSize        =   9.75
  152.          FontStrikethru  =   0   'False
  153.          FontUnderline   =   0   'False
  154.          Height          =   255
  155.          Left            =   1425
  156.          TabIndex        =   2
  157.          Top             =   480
  158.          Width           =   255
  159.       End
  160.    End
  161.    Begin Menu MenuAbout 
  162.       Caption         =   "&About"
  163.    End
  164. End
  165. Dim CRLF As String
  166.  
  167. Sub CancelFinger ()
  168.  
  169.     NetClient.Connect = False
  170.  
  171.     TextHost.Enabled = True
  172.     TextUserName.Enabled = True
  173.  
  174.     Main.MousePointer = 0
  175.     PanelLocalName.MousePointer = 2
  176.     StatusBar.MousePointer = 0
  177.  
  178. End Sub
  179.  
  180. Sub FingerUser ()
  181. Dim sDebugString As String
  182.  
  183.     On Error Resume Next
  184.  
  185.     StatusBar.Caption = "Ok."
  186.     
  187.     TextDisplay.Text = ""
  188.  
  189.     ' WSNetC code
  190.     NetClient.HostName = TextHost
  191.     If NetClient.HostName = "" Then
  192.         NetClient.HostAddr = TextHost
  193.         If NetClient.HostAddr = "" Then
  194.             StatusBar = "Sorry, " & TextHost & " could not be resolved."
  195.             Exit Sub
  196.         End If
  197.     End If
  198.     NetClient.Connect = True
  199.     
  200.     ' We are completing a query, ignore user
  201.     TextDisplay.SetFocus
  202.     TextUserName.Enabled = False
  203.     TextHost.Enabled = False
  204.  
  205.     StatusBar.Caption = "Connecting to Host - Click this message to Abort"
  206.     
  207.     Main.MousePointer = 11
  208.     PanelLocalName.MousePointer = 12
  209.     StatusBar.MousePointer = 2
  210.  
  211. End Sub
  212.  
  213. Sub Form_Load ()
  214.     
  215.     On Error Resume Next
  216.  
  217.     If NetClient.HostName <> "" Then
  218.         PanelLocalName = NetClient.HostName
  219.         LabelLocalAddr = NetClient.HostAddr
  220.     Else
  221.         PanelLocalName = "LocalHost"
  222.         LabelLocalAddr = "unknown address"
  223.     End If
  224.     
  225.     CRLF = Chr$(13) + Chr$(10)
  226.  
  227.     ' We want to grab everything in "chunks"
  228.     NetClient.LineDelimiter = ""
  229.     NetClient.SendSize = 512
  230.     NetClient.RecvSize = 8192
  231.  
  232.     ' Use the "finger" service (or port 79)
  233.     NetClient.RemoteService = "finger"
  234.     If NetClient.RemotePort = 0 Then
  235.         NetClient.RemotePort = 79
  236.     End If
  237.  
  238.     ' Handle saved user info
  239.     Ini.Filename = "wfinger.ini"
  240.     Ini.Section = "Configuration"
  241.     
  242.     Ini.Entry = "DefaultUserName"
  243.     If Ini.Value = "" Then
  244.         Ini.Value = "iblenke"
  245.     End If
  246.     TextUserName.Text = Ini.Value
  247.  
  248.     Ini.Entry = "DefaultHostName"
  249.     If Ini.Value = "" Then
  250.         Ini.Value = "rhino.ess.harris.com"
  251.     End If
  252.     TextHost.Text = Ini.Value
  253.  
  254.     Ini.Section = "Windows"
  255.     Main.Top = gfMISCIniGetInt("Main.Top", (Main.Top))
  256.     Main.Left = gfMISCIniGetInt("Main.Left", (Main.Left))
  257.     Main.Width = gfMISCIniGetInt("Main.Width", (Main.Width))
  258.     Main.Height = gfMISCIniGetInt("Main.Height", (Main.Height))
  259.  
  260.     Main.Show
  261.  
  262. End Sub
  263.  
  264. Sub Form_QueryUnload (Cancel As Integer, UnloadMode As Integer)
  265.  
  266.     If UnloadMode = 0 Then
  267.         Ini.Section = "Windows"
  268.         gsMISCIniPutInt "Main.Top", (Main.Top)
  269.         gsMISCIniPutInt "Main.Left", (Main.Left)
  270.         gsMISCIniPutInt "Main.Width", (Main.Width)
  271.         gsMISCIniPutInt "Main.Height", (Main.Height)
  272.     End If
  273.  
  274. End Sub
  275.  
  276. Sub Form_Resize ()
  277.     
  278.     If Main.WindowState = 1 Then Exit Sub
  279.     
  280.     LabelLocalAddr.Width = Abs(ScaleWidth - 240)
  281.  
  282.     FrameTextDisplay.Width = Abs(ScaleWidth - 240)
  283.     FrameTextDisplay.Height = Abs(ScaleHeight - FrameTextDisplay.Top - StatusBar.Height - 120)
  284.  
  285.     TextDisplay.Width = Abs(FrameTextDisplay.Width - 240)
  286.     TextDisplay.Height = Abs(FrameTextDisplay.Height - 360)
  287.  
  288.     PanelHost.Width = Abs(ScaleWidth - PanelHost.Left - 120)
  289.  
  290. End Sub
  291.  
  292. Sub Form_Unload (Cancel As Integer)
  293.     
  294.     Ini.Entry = "DefaultHostName"
  295.     Ini.Value = TextHost.Text
  296.  
  297.     Ini.Entry = "DefaultUserName"
  298.     Ini.Value = TextUserName.Text
  299.  
  300. End Sub
  301.  
  302. Sub LabelLocalAddr_DblClick ()
  303.     
  304.     PanelLocalName_DblClick
  305.  
  306. End Sub
  307.  
  308. Sub MenuAbout_Click ()
  309.     
  310.     gsMISCAboutLoad "WFinger", "WFinger v1.0", "This client can query remote hosts through the Finger service (typically port 79). You can usually leave the 'User name' field empty for a full listing of people logged in."
  311.  
  312. End Sub
  313.  
  314. Sub NetClient_OnClose ()
  315.     
  316.     On Error Resume Next
  317.     
  318.     CancelFinger
  319.  
  320.     StatusBar.Caption = "Connection closed."
  321.     
  322. End Sub
  323.  
  324. Sub NetClient_OnConnect ()
  325.     
  326.     On Error Resume Next
  327.  
  328.     FrameTextDisplay.Caption = TextUserName & "@" & TextHost
  329.     StatusBar.Caption = "Connected to port" & Str$(NetClient.RemotePort) & ". Click this message to Abort"
  330.     NetClient.SendLine = TextUserName.Text & CRLF
  331.  
  332. End Sub
  333.  
  334. Sub NetClient_OnError (iErrorNumber As Integer)
  335. Dim ErrorMessage As String
  336. Dim ErrorNumberText As String
  337.  
  338.     On Error Resume Next
  339.  
  340.     ErrorMessage = NetClient.ErrorMessage
  341.     ErrorNumberText = Str$(iErrorNumber)
  342.  
  343.     StatusBar.Caption = "Error #" & ErrorNumberText & ": " & ErrorMessage
  344.     
  345.     ' Disconnect for good measure
  346.     CancelFinger
  347.  
  348. End Sub
  349.  
  350. Sub NetClient_OnRecv ()
  351. Dim sInput As String
  352.  
  353.     On Error Resume Next
  354.  
  355.     sInput = NetClient.RecvLine
  356.     
  357.     ' Loop until buffer is empty (this doesn't block)
  358.     Do While Not (sInput = "")
  359.         TextDisplay.Text = TextDisplay.Text + sInput
  360.         sInput = NetClient.RecvLine
  361.     Loop
  362. End Sub
  363.  
  364. Sub PanelLocalName_DblClick ()
  365.     
  366.     PanelLocalName.BevelOuter = 1
  367.     PanelLocalName.Font3D = 2
  368.     FingerUser
  369.     PanelLocalName.Font3D = 1
  370.     PanelLocalName.BevelOuter = 2
  371.  
  372. End Sub
  373.  
  374. Sub StatusBar_DblClick ()
  375.  
  376.     If Not NetClient.Connect Then Exit Sub
  377.  
  378.     StatusBar.BevelOuter = 1
  379.     CancelFinger
  380.     StatusBar.BevelOuter = 2
  381.  
  382.     StatusBar.Caption = "Finger aborted."
  383.  
  384. End Sub
  385.  
  386. Sub TextHost_GotFocus ()
  387.     PanelHost.BevelOuter = 1
  388.     TextHost.SelStart = 0
  389.     TextHost.SelLength = 128
  390. End Sub
  391.  
  392. Sub TextHost_KeyPress (KeyAscii As Integer)
  393.  
  394.     If KeyAscii = 13 Then
  395.         FingerUser
  396.         KeyAscii = 0
  397.     End If
  398. End Sub
  399.  
  400. Sub TextHost_LostFocus ()
  401.     PanelHost.BevelOuter = 2
  402.  
  403. End Sub
  404.  
  405. Sub TextUserName_GotFocus ()
  406.     PanelUsername.BevelOuter = 1
  407.     TextUserName.SelStart = 0
  408.     TextUserName.SelLength = 64
  409. End Sub
  410.  
  411. Sub TextUserName_KeyPress (KeyAscii As Integer)
  412.     
  413.     If KeyAscii = 13 Then
  414.         FingerUser
  415.         KeyAscii = 0
  416.     End If
  417. End Sub
  418.  
  419. Sub TextUsername_LostFocus ()
  420.     PanelUsername.BevelOuter = 2
  421. End Sub
  422.  
  423.